package main

import (
	"fmt"
	"github.com/confluentinc/confluent-kafka-go/kafka"
)

func main() {

	c, err := kafka.NewConsumer(&kafka.ConfigMap{
	"bootstrap.servers": "10.20.0.10:9092",
	"group.id":          "myGroup",
	"auto.offset.reset": "earliest",
	})

	if err != nil {
	panic(err)
	}

	c.SubscribeTopics([]string{"cmdb2"}, nil)

	for {
	msg, err := c.ReadMessage(-1)
	if err == nil {
	fmt.Println("1111", msg.TopicPartition, string(msg.Value))
	} else {
	// The client will automatically try to recover from all errors.
	fmt.Printf("Consumer error: %v (%v)\n", err, msg)
	}
	}

	c.Close()
}